package com.zhima.controller.feign;

import com.zhima.enums.UserQuestionState;
import com.zhima.service.OjUserQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : Administer
 * @date : 2023-09-18 14:08
 **/
@RestController
@RequestMapping("/user-question/feign")
public class UserQuestionFeignController {
    @Autowired
    private OjUserQuestionService ojUserQuestionService;

    /**
     * 更新或者为指定用户增加一条做题记录
     *
     * @param questionId
     * @param userQuestionState
     * @return
     */
    @PutMapping("/{userId}/{questionId}/{userQuestionState}")
    public boolean addUserQuestion(@PathVariable("userId") Long userId, @PathVariable("questionId") Long questionId, @PathVariable UserQuestionState userQuestionState) {
        return ojUserQuestionService.addUserQuestion(userId, questionId, userQuestionState);
    }
}
